package cn.yangliu.jpa;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.Sort;

/**
 * @author 杨柳
 * @date 2019-06-20
 */
@Getter
@Setter
public class PageInfo {

    private int page;
    private int size;

    private int total = 0;

    private Sort sort = Sort.unsorted();

    public int getOffset() {
        return this.page * this.size;
    }

    public PageInfo(int page, int size) {
        this.page = page;
        this.size = size;
    }

    public PageInfo(int page, int size, Sort sort) {
        this.page = page;
        this.size = size;
        this.sort = sort;
    }

}